//
//  JSONRPCService.h
//  WorldCupResource
//
//  Created by Kyaw Phyu Aung on 24.4.10..
//  Copyright 2010 Dizzey.com. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol JSONRPCServiceDelegate
-(void) dataLoaded:(NSData*)data;
-(void) loadingFailed:(NSString*) errMsg;
@end


@interface JSONRPCService : NSObject {
	NSURL* url;
	NSURLConnection *urlConnection;

	id<JSONRPCServiceDelegate> delegate;
	
	NSString* username;
	NSString* password;
	
	NSMutableData* webData;
}

@property (assign) id<JSONRPCServiceDelegate> delegate;

-(id) initWithURL:(NSURL*)serviceURL;
-(id) initWithURL:(NSURL*)serviceURL user:(NSString*)user pass:(NSString*)pass;

-(void) execPostMethod;

-(NSString*) execGetMethod:(NSURL*)getURL;

-(void) cancelRequest;

-(NSMutableArray*) getAllParks;

-(NSMutableArray*) getAllParkAreas:(NSString *)parkName;

-(NSMutableArray*) getPitsByParkAndArea:(NSString *)parkName andParkArea:(NSString *)parkAreaName;

-(NSString*) saveBooking:(NSString*)parkName andPitName:(NSString*)pitName andCustomerName:(NSString*)customerName andCustomerNRIC:(NSString*)customerNRIC;

@end
